<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="90px"
    >
      <el-form-item label="公司名称:" prop="hzmc">
        <!-- <el-input
          v-model="queryParams.customerDescr"
          placeholder="请输入客户名称"
          clearable
          @keyup.enter.native="handleQuery"
        /> -->
        <el-select
          v-model="queryParams.hzmc"
          filterable
          placeholder="请选择公司名称"
          clearable
        >
          <el-option
            v-for="item in customerData"
            :key="item.customerId"
            :label="item.customerName"
            :value="item.customerName"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="商品编码:" prop="sku">
        <el-input
          v-model="queryParams.sku"
          placeholder="请输入商品编码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="海川码:" prop="fmcustomerId">
        <el-input
          v-model="queryParams.fmcustomerId"
          placeholder="请输入海川码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-table
      v-loading="loading"
      :data="varietyList"
      @selection-change="handleSelectionChange"
    >
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
      <el-table-column label="海川码" align="center" prop="fmcustomerId" />
      <el-table-column label="货主ID" align="center" prop="customerId" />
      <el-table-column label="货主名称" align="center" prop="hzmc" />
      <el-table-column label="商品编码" align="center" prop="sku" />
      <el-table-column label="商品名称" align="center" prop="skuDescr1" />
      <el-table-column label="商品简称" align="center" prop="easyCode" />
      <el-table-column label="规格/型号" align="center" prop="alternateSku3" />
      <el-table-column
        label="批准文号/注册证/备案凭证号"
        align="center"
        prop="approvalNo"
      />
      <el-table-column label="生产厂家" align="center" prop="alternateSku4" />
      <el-table-column label="商品价格" align="center" prop="cgj" />
      <!-- <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:money:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:money:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column> -->
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import {
  listMoney,
  getMoney,
  delMoney,
  addMoney,
  updateMoney,
  customerList,
  listowner,
} from "@/api/system/money";

export default {
  name: "Money",
  data() {
    return {
      customerData: [],
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 库存金额预警表格数据
      varietyList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        hzmc: null,
        sku: null,
        fmcustomerId:null,
      },
      // 表单参数
      form: {
        customerId: "",
      },
      // 表单校验
      rules: {},
      restaurants: [],
    };
  },
  created() {
    // this.getList();
    this.customlist();
  },
  mounted() {},
  methods: {
    // 客户名称
    customlist() {
      customerList().then((res) => {
        this.customerData = res.data;
      });
    },

    /** 查询库存金额预警列表 */
    getList() {
      this.loading = true;
      listowner(this.queryParams).then((response) => {
        this.varietyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    // cancel() {
    //   this.open = false;
    //   this.reset();
    // },
    // // 表单重置
    // reset() {
    //   this.form = {
    //     id: null,
    //     customerId: null,
    //     customerName: null,
    //     kcje: null,
    //   };
    //   this.resetForm("form");
    // },
    /** 搜索按钮操作 */
    handleQuery() {
      //   this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
  },
};
</script>
<style scoped>
.el-select {
  width: 100%;
}
</style>
